package initialize

import (
	"context"
	"fmt"
	"gitee.com/youbeiwuhuan/gin-practice/fizz-gorm2/global"
	"gitee.com/youbeiwuhuan/gin-practice/fizz-gorm2/global/config"
	"gitee.com/youbeiwuhuan/gin-practice/fizz-gorm2/tools/configs"
	"gitee.com/youbeiwuhuan/gin-practice/fizz-gorm2/tools/logger"
)

func loandConfig() {
	log := logger.New(context.Background(), GetZap())
	global.ViperCfg = configs.Load()

	if err := global.ViperCfg.Unmarshal(&config.TotalConfig); err != nil {
		panic(fmt.Sprintf("loandConfig err:%v", err))
	}

	//fmt.Printf("------TotalConfig----%+v \n", config.TotalConfig)
	log.Info("------TotalConfig---- \n", config.TotalConfig)
	log.Info("------load config success---------\n")
}
